home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr25 / mrp_099b.zip / MSG2REP.CMD < prev    next >
OS/2 REXX Batch file  |  1993-06-20  |  3KB  |  99 lines

  1. /*
  2.     MR/2 - MSG2REP.CMD
  3.  
  4.     Author:     Nick Knight
  5.     Created:    03/26/93
  6.     Usage:        msg2rep packet.rep packet.msg
  7.     Purpose:
  8.  
  9.     The author claims no copyright to this particular REXX script.
  10.     Feel free to copy it and/or use it for other purposes.  I *would*
  11.     like to see the results of any improvements to it.
  12.  
  13.     US Mail:    Nick Knight, 1823 David Ave.,  Parma, Ohio 44134
  14.     Fidonet:    1:157/2 or 1:/157/200
  15.     Internet:    nick.knight@pcohio.com
  16.     Compuserve: 76066,1240
  17.     BBS:        Private messages on Nerd's Nook, 356-1772 or 356-1872
  18. */
  19.  
  20. /***********************************************************************/
  21. /*        A R C H I V E R     C O M M A N D     D E F I N I T I O N S       */
  22. /***********************************************************************/
  23. /*    To add support for a new unpacker, simply supply a new command
  24.     definition here.  The file name to unpack will be appended to
  25.     the end of the supplied command.  You can customize in more detail
  26.     by modifying the code directly, if need be.
  27. */
  28.  
  29. /*path = 'c:\utility\' */
  30. path = ''
  31.  
  32. zip_command =        'pkzip'
  33. infozip_command =    'zip -j'
  34. arj_command =        'arj u'
  35. zoo_command =        'zoo u'
  36. lharc_command =     'lha u'
  37. lha_command =        'lh a /i'
  38. /*lha_command =       'lh a /i' */      /* for lh2 for OS/2 */
  39. arc_command =        'arc u'
  40.  
  41. noidfile_command =    zip_command
  42.  
  43. /***********************************************************************/
  44. /*                    U N Q W K     F I L E N A M E                       */
  45. /***********************************************************************/
  46. /*
  47.     Returns -1 if it the file "archive.id" is bad or non-existent.
  48.     Otherwise, the "archive_id" is returned (1 -> 6).
  49. */
  50.  
  51. parse arg filename msgfile
  52.  
  53. idfile = "archiver.id"
  54.  
  55. /*
  56. 04/02/93 - if no packet entry, unarchiver wasn't used - default to something
  57. if stream(idfile,'c','query exists') = "" then do
  58.     return -1
  59. end
  60. */
  61.  
  62. if stream(idfile,'c','query exists') = "" then do
  63.     archiver_id = -1
  64. end
  65. else do
  66.     archiver_id = linein(idfile,1,1)
  67.     status = lineout(idfile)
  68. end
  69.  
  70. /*if archiver_id = 1 then archiver_id = 7 */
  71.  
  72. select                                        /* execute the corresponding command */
  73.     when archiver_id = 1 then path || zip_command filename msgfile
  74.     when archiver_id = 2 then path || arj_command filename msgfile
  75.     when archiver_id = 3 then path || zoo_command filename msgfile
  76.     when archiver_id = 4 then path || lharc_command filename msgfile
  77.     when archiver_id = 5 then path || lha_command filename msgfile
  78.     when archiver_id = 6 then path || arc_command filename msgfile
  79.     when archiver_id = 7 then do
  80.         parse arg filebase"."ext
  81.         path || infozip_command filebase msgfile
  82.         if RC = 0 then do
  83.             'copy' filebase||".zip" filebase||".rep"
  84.         end
  85.         if RC = 0 then do
  86.             'del' filebase||".zip"
  87.         end
  88.     end
  89.     when archiver_id = -1 then path || noidfile_command filename msgfile
  90.     otherwise
  91.         say "UNKNOWN ARCHIVE TYPE: " filename "(" archiver_id ")"
  92.         RC = -1
  93. end
  94.  
  95. if RC <> 0 then return -1
  96.  
  97. return 0
  98.  
  99.